import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const state = {
	userInfo:{
		avatar:'',
		nickname:'',
		phone:null,
	},
	noLogin:false,//定义当前用户没登录
	template:null,//用户进行模板快速填充时选择的模板
	typeData:null,//类型数据
}
const actions = {
	userInfo ({commit} , data){
		commit('USERINFO',data)
	},
	noLogin ({commit} , data){
		console.log('nologin')
		commit('NOLOGIN' , data)
	},
	template ({commit} , data){
		commit('TEMPLATE' , data)
	},
	typeData ({commit} , data){
		commit('TYPEDATA' , data)
	}
}

const mutations = {
	USERINFO (state,data){
		state.userInfo = data
	},
	NOLOGIN (state,data){
		state.noLogin = data
	},
	TEMPLATE (state,data){
		state.template = data
	},
	TYPEDATA (state,data){
		state.typeData = data
	}
	
}
const store = new Vuex.Store({
    state:state,
    mutations: mutations,
    actions:actions
})
export default store